Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
soc:2009:lynusvaz:notes:start [2009/06/01 21:45]
lynusvaz
soc:2009:lynusvaz:notes:start [2009/08/05 09:17]
lynusvaz
Line 3: Line 3:
 I've taken a few ideas from Fabrice Bellard'​s C OTCC compiler: http://​bellard.org/​otcc/​ I've taken a few ideas from Fabrice Bellard'​s C OTCC compiler: http://​bellard.org/​otcc/​
  
 +Also looking at [[http://​www.gnu.org/​software/​bash/​bash.html|bash]]
  
 +Here's the POSIX specification for the shell: [[http://​www.opengroup.org/​onlinepubs/​009695399/​utilities/​xcu_chap02.html]]
  
 +And the PXE specification:​ [[http://​www.pix.net/​software/​pxeboot/​archive/​pxespec.pdf]]
 +
 +Proposed syntax:
 +  ​
 +  LINES           => LINE '​\n'​ LINES | e
 +  LINE            => WORD | WORD WS ARG_LIST | e
 +  ARG_LIST ​       => ARG WS ARG_LIST | e
 +  ARG             => WORD
 +  SP              => ' ' | '​\t'​
 +  WS              => SP | SP WS
 +  NOT_EXP ​        => (any - { SP, '​$(',​ '​)',​ '​${',​ '​}'​) ​   /* Represents characters not expanded */
 +  WORD            => NOT_EXP WORD | EXP WORD | NOT_EXP | EXP
 +  EXP             => EXPR_EXP | VAR_EXP ​               /* Expansions */
 +  EXPR_EXP ​       => '​$('​ EXPR '​)'​
 +  VAR_EXP ​        => '​${'​ (any - { '​}'​ })+ '​}' ​      
 +  EXPR            => TERM | TERM BIN_OP EXPR | MONO_OP EXPR
 +  TERM            => VAR_EXP | STRING
 +  NUM             => ('​+'​ | '​-'​ )? ( '​('​ EXPR '​)'​ | (digit)+ )               
 +  STRING ​         => (any - { '​$(',​ '​)',​ '​${',​ '​}',​ ' ', BIN_OP, MONO_OP})+ ​   /* This will help with string comparison */
 +  BIN_OP ​         => '​*'​ |  '/'​ | '​%' ​            /* Convert both operands to integers */
 +                     | '​+'​ | '​-'​
 +                     | '<<'​ |  '>>'​
 +                     | '<'​ | '<​='​ | '>'​ | '>​='​
 +                     | '​!='​ | '​==' ​                         /* Should also work for strings */
 +                     | '&'​
 +                     | '​|'​
 +                     | '​^'​
 +                     | '&&'​
 +                     | '​||'​
 +  MONO_OP ​        => '​~'​ | '​!'​
 +
 +Syntax for if-else branches:
 +  if <​condition>​
 +      <​statements>​
 +  [ else
 +      <​statements>​ ]
 +  fi
 +
 +Proposed syntax for while loops:
 +  while <​condition>​
 +  do
 +      <​statements>​
 +  done
 +
 +Proposed syntax for for loops:
 +  for <​variable>​ in <value list>
 +  do
 +      <​statements>​
 +  done
 +Pretty similar to the shell syntax, so it should be familiar.
 +
 +[[.:​scripting_doc:​Features added]]

Navigation

* [[:start|Home]] * [[:about|About our Project]] * [[:download|Download]] * [[:screenshots|Screenshots]] * Documentation * [[:howtos|HowTo Guides]] * [[:appnotes|Application Notes]] * [[:faq:|FAQs]] * [[:doc|General Doc]] * [[:talks|Videos, Talks, and Papers]] * [[:hardwareissues|Hardware Issues]] * [[:mailinglists|Mailing lists]] * [[http://support.etherboot.org/|Bugtracker]] * [[:contributing|Contributing]] * [[:editing_permission|Wiki Edit Permission]] * [[:wiki:syntax|Wiki Syntax]] * [[:contact|Contact]] * [[:relatedlinks|Related Links]] * [[:commerciallinks|Commercial Links]] * [[:acknowledgements|Acknowledgements]] * [[:logos|Logo Art]]

QR Code
QR Code soc:2009:lynusvaz:notes:start (generated for current page)