Add support for "implementation-defined literals" $file, $line, $module,

Estimated hours taken: 16
Branches: main

Add support for "implementation-defined literals" $file, $line, $module,
$pred, $grade which are replaced constants by the compiler.

library/lexer.m:
	Add a new type of token.

	Read "$foo" as a `implementation_defined' token instead of two name
	tokens.

library/term.m:
library/term_io.m:
	Add a new type of constant, `implementation_defined'.

library/parser.m:
	Handle `implementation_defined' tokens from the lexer.

compiler/check_hlds.m:
compiler/implementation_defined_literals.m:
compiler/mercury_compile.m:
	Add a new pass to replace implementation-defined literals in program
	clauses.

	Call the new pass.

compiler/notes/compiler_design.html:
	Document the new module.

compiler/prog_data.m:
	Add a new option to `cons_id', namely `implementation_defined_const'.

compiler/typecheck.m:
	Tell the typechecker the types of the supported implementation-defined
	literals.

compiler/prog_io_util.m:
	Make `convert_bound_inst' fail if implementation-defined literals
	appear in inst definitions so that an error will be issued.

compiler/bytecode_gen.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/erl_unify_gen.m:
compiler/fact_table.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_out.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.m:
compiler/prog_rep.m:
compiler/prog_type.m:
compiler/prog_util.m:
compiler/rbmm.execution_path.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
	Conform to addition of `implementation_defined_const'.

doc/reference_manual.texi:
	Document implementation-defined literals.

NEWS:
	Announce the new feature.

tests/hard_coded/Mmakefile:
tests/hard_coded/impl_def_lex.exp:
tests/hard_coded/impl_def_lex.m:
tests/hard_coded/impl_def_lex_string.exp:
tests/hard_coded/impl_def_lex_string.m:
tests/hard_coded/impl_def_literal.exp:
tests/hard_coded/impl_def_literal.m:
tests/invalid/Mmakefile:
tests/invalid/impl_def_literal_syntax.err_exp:
tests/invalid/impl_def_literal_syntax.m:
tests/invalid/undef_impl_def_literal.err_exp:
tests/invalid/undef_impl_def_literal.m:
	Add test cases.
This commit is contained in:
Peter Wang
2008-04-03 05:26:48 +00:00
parent 72a2c22281
commit fffedfba7c
44 changed files with 728 additions and 5 deletions

View File

@@ -628,6 +628,7 @@ cons_id(cons(Name, Arity)) = elem("cons", [], [name(Name), arity(Arity)]).
cons_id(int_const(I)) = tagged_int("int", I).
cons_id(string_const(S)) = tagged_string("string", S).
cons_id(float_const(F)) = tagged_float("float", F).
cons_id(implementation_defined_const(_)) = nyi("implementation_defined_const").
cons_id(pred_const(_, _)) = nyi("pred_const").
cons_id(type_ctor_info_const(_, _, _)) = nyi("type_ctor_info_const").
cons_id(base_typeclass_info_const(_,_,_,_)) = nyi("base_typeclass_info_const").